<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>

        var a;
        var b;
        var c;
        var d;
        var e;

        function $(id) {
            return document.getElementById(id);
        }

        function checkName() {
            var name = /^[a-zA-Z]{2,20}$/
            var spanObj = $("nameSpan");
            if (name.test($("nameInput").value)) {
                spanObj.innerHTML = "√"
                spanObj.style.color = "green"
                spanObj.style.fontSize = "15px"
                a = true;
                open();
            } else {
                spanObj.innerHTML = "×"
                spanObj.style.color = "red"
                spanObj.style.fontSize = "15px"
                a = false;
                open();
            }
        }

        function checkPwd() {
            var pwd = /^[0-9]{6}$/
            var spanObj = $("pwdSpan");
            if (pwd.test($("pwdInput").value)) {
                spanObj.innerHTML = "√"
                spanObj.style.color = "green"
                spanObj.style.fontSize = "15px"
                b = true;
                open();
            } else {
                spanObj.innerHTML = "×"
                spanObj.style.color = "red"
                spanObj.style.fontSize = "15px"
                b = false;
            }
        }

        function checkEm() {
            var em = /^[a-zA-Z0-9]{3,12}@[a-zA-Z0-9]{2,3}[.](com|cn|net)$/
            var spanObj = $("emSpan");
            if (em.test($("emInput").value)) {
                spanObj.innerHTML = "√"
                spanObj.style.color = "green"
                spanObj.style.fontSize = "15px"
                c = true;
                open();
            } else {
                spanObj.innerHTML = "×"
                spanObj.style.color = "red"
                spanObj.style.fontSize = "15px"
                c = false;
                open();
            }
        }
        function checkPhone() {
            var phone = /^1[358]\d{9}$/
            var spanObj = $("phoneSpan");
            if (phone.test($("phoneInput").value)) {
                spanObj.innerHTML = "√"
                spanObj.style.color = "green"
                spanObj.style.fontSize = "15px"
                d = true;
                open();
            } else {
                spanObj.innerHTML = "×"
                spanObj.style.color = "red"
                spanObj.style.fontSize = "15px"
                d = false;
                open();
            }
        }
        function checkBirthday() {
            var birth = /^(19|20)\d{2}-(1[0-2]|0?[1-9])-(0?[1-9]|[1-2][0-9]|3[0-1])$/
            var spanObj = $("birthSpan");
            if (birth.test($("birthInput").value)) {
                spanObj.innerHTML = "√"
                spanObj.style.color = "green"
                spanObj.style.fontSize = "15px"
                e = true;
                open();
            } else {
                spanObj.innerHTML = "×"
                spanObj.style.color = "red"
                spanObj.style.fontSize = "15px"
                e = false;
                open();
            }
        }
        function open() {
            if (a && b && c && d && e) {
                document.getElementById("buttonInput").disabled = false;
            } else {
                document.getElementById("buttonInput").disabled = true;
            }
        }

    </script>
</head>
<body>
<form style="margin:50px 200px">
    用户名：<input type="text" id="nameInput" onblur="checkName();">
    <span id="nameSpan"></span>
    <!--密码必须是6位数字。-->
    <br> 密 码：<input type="password" id="pwdInput" onblur="checkPwd()">
    <span id="pwdSpan"></span>
    <br> 邮 箱：<input type="text" id="emInput" onblur="checkEm()">
    <span id="emSpan"></span>
    <br> 电 话：<input type="text" id="phoneInput" onblur="checkPhone()">
    <span id="phoneSpan"></span>
    <br> 生 日：<input type="text" id="birthInput" onblur="checkBirthday()">
    <span id="birthSpan"></span>
    <br> <input style="margin:50px 50px 0px 150px" disabled type="button" value="提交" id="buttonInput">
</form>
</body>
</html>